package cn.yiueil.service.impl;

import cn.yiueil.annotation.Log;
import cn.yiueil.annotation.Time;
import cn.yiueil.entity.User;
import cn.yiueil.mapper.UserMapper;
import cn.yiueil.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Random;

@Service
@Transactional
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public void register(User user) {
        userMapper.add(user);
    }

    @Log
    @Time
    @Override
    public User login(String user, String password) {
        try {
            Thread.sleep(new Random().nextInt(6000));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return null;
    }
}
